<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>角色</title>
    <link rel="stylesheet" href="/css/styletable.css" type="text/css"/>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <script src="/layui/layui.all.js" charset="utf-8"></script>
    <script src="/js/jquery.2.1.4.js" charset="utf-8"></script>

    <style>
        td,th{
            height: 35px;
        }
    </style>

    <script type="text/javascript">
        function editprob(th) {
            if ($(th).text() == "确定") {
                var v = $("#probtext").val();
                if (isNaN(v)){
                    layer.alert('只能输入数字', {
                        skin: 'layui-layer-molv'
                        , closeBtn: 0
                    });
                }
                $.ajax({
                    url: "/role/upprob",
                    type: "POST",
                    //dataType: "json",
                    data: {prob: $("#probtext").val()},
                    async: false,
                    success: function () {
                        window.location.href = "/role/totimes";
                    }
                });
            }
            $(th).parent().prev().html('<input id="probtext" style="width: 100%;height: 35px" type="text">');
            $("#probtext").val(${times.probtime}).focus();
            $(th).addClass("layui-btn-edit");
            $(th).text("确定");
        }

        function editpass(th) {
            if ($(th).text() == "确定") {
                var v = $("#passtext").val();
                if (isNaN(v)){
                    layer.alert('只能输入数字', {
                        skin: 'layui-layer-molv'
                        , closeBtn: 0
                    });
                }
                $.ajax({
                    url: "/role/uppass",
                    type: "POST",
                    //dataType: "json",
                    data: {pass: $("#passtext").val()},
                    async: false,
                    success: function () {
                        window.location.href = "/role/totimes";
                    }
                });
            }
            $(th).parent().prev().html('<input id="passtext" style="width: 100%;height: 35px" type="text">');
            $("#passtext").val(${times.passtime}).focus();
            $(th).addClass("layui-btn-edit");
            $(th).text("确定");
        }
    </script>
</head>
<body>

<div style="margin: 100px 80px 0px 80px">
    <table style="width: 100%">
        <tr>
            <th width="5%"></th>
            <th width="40%">设置</th>
            <th width="30%">值（天）</th>
            <th width="25%">操作</th>
        </tr>

        <tr>
            <td></td>
            <td>问题时效</td>
            <td id="prob">${times.probtime}</td>
            <td align="center">
                <button class="layui-btn layui-btn-mini" onclick="editprob(this);">编辑</button>
            </td>
        </tr>

        <tr>
            <td></td>
            <td id="pass">逾期时间</td>
            <td>${times.passtime}</td>
            <td align="center">
                <button class="layui-btn layui-btn-mini" onclick="editpass(this)">编辑</button>
            </td>
        </tr>
    </table>
</div>

</body>
</html>
